using System.Threading;
using Microsoft.Practices.CompositeUI;
using Microsoft.Practices.ObjectBuilder;
using NetRosApp.Infrastructure.Interface.Services;


namespace NetRosApp.Infrastructure.Module
{
    public class ParametriActionCondition : IActionCondition
    {
        
        private IParametriAplikacijeService _actionservice;
        

        public ParametriActionCondition(IParametriAplikacijeService ActionService)
        {
            _actionservice = ActionService;
        }
        
            

        public bool CanExecute(string action, WorkItem context, object caller, object target)
        {
            if (_actionservice == null) return false;
            if (_actionservice.Actions.ContainsKey("Admin")) return true;
            return _actionservice.Actions.ContainsKey(action);
            
        }
    }

}
